#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

int common(int cx, int cy)
{
	if (cx == cy)
		return cx;
	else if (cx > cy)
		return common(cx / 2, cy);
	else
		return common(cx, cy / 2);
}
int main()
{
	int x = 0, y = 0;
	scanf("%d %d", &x, &y);

	int ret = common(x, y);
	printf("%d", ret);
	return 0;
}